package cn.shangtour.order.service;

import java.util.Date;
import java.util.List;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.shangtour.common.pojo.Order;
import cn.shangtour.order.mapper.OrderMapper;

	@Service
	public class OrderService {
		@Autowired
		private OrderMapper orderMapper;
       //新增订单
		public void saveOrder(Order order) {
			//补充数据 uuid orderId orderTime payState
			order.setOrderId(UUID.randomUUID().toString());
			//订单时间
			order.setOrderTime(new Date());
			//支付状态
			order.setOrderPaystate(0);
			//其他
			//TODU
			orderMapper.saveOrder(order);
		}
		//查询订单
		public List<Order> queryMyOrder(String userId) {
			return orderMapper.queryOrder(userId);
			
		}
		//删除订单
		public void deleteOrder(String orderId) {
			orderMapper.deleteOrder(orderId);
			
		}
}
